'\" te
.\"  Copyright 1989 AT&T  Copyright (c) 1998, Sun Microsystems, Inc.  All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH SETLABEL 3C "June 19, 2021"
.SH NAME
setlabel \- define the label for \fBpfmt()\fR and \fBlfmt()\fR
.SH SYNOPSIS
.nf
#include <pfmt.h>

\fBint\fR \fBsetlabel\fR(\fBconst char *\fR\fIlabel\fR);
.fi

.SH DESCRIPTION
The \fBsetlabel()\fR function defines the label for messages produced in
standard format by subsequent calls to \fBlfmt\fR(3C) and \fBpfmt\fR(3C).
.sp
.LP
The \fIlabel\fR argument is a character string no more than 25 characters in
length.
.sp
.LP
No label is defined before \fBsetlabel()\fR is called. The label should be set
once at the beginning of a utility and remain constant. A null pointer or an
empty string passed as argument will reset the definition of the label.
.SH RETURN VALUE
Upon successful completion, \fBsetlabel()\fR returns \fB0\fR; otherwise, it
returns a non-zero value.
.SH EXAMPLES
The following code (without previous call to \fBsetlabel()\fR):
.sp
.in +2
.nf
pfmt(stderr, MM_ERROR, "test:2:Cannot open file\en");
setlabel("UX:test");
pfmt(stderr, MM_ERROR, "test:2:Cannot open file\en");
.fi
.in -2

.sp
.LP
will produce the following output:
.sp
.in +2
.nf
ERROR: Cannot open file
UX:test: ERROR: Cannot open file
.fi
.in -2

.SH ATTRIBUTES
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
MT-Level	MT-Safe
.TE

.SH SEE ALSO
.BR getopt (3C),
.BR lfmt (3C),
.BR pfmt (3C),
.BR attributes (7)
